/*
Copyright 2009 Swivel4J

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package org.swivel4j.chart;

/**
 * Basic CRUD opertions for Swivel charts.
 * @author Ken Weiner
 * @version $Id: ChartClient.java 2 2009-11-28 01:59:25Z kweiner $
 */
public interface ChartClient {
	/**
	 * Creates a new chart with the given name and data.
	 * Keep track of the chart ID as given by {@link Chart#getId()}
	 * It will be used for reading, updating, and deleting the chart.
	 * @param name the chart name
	 * @param data the initial chart data in CSV format
	 * @return the chart metadata
	 */
    Chart createChart(String name, String data);

    /**
     * Gets the chart metadata given a chart ID.
     * @param chartId the chart ID
     * @return the chart metadata
     */
    Chart getChartMetadata(Integer chartId);

    /**
     * Gets the chart data given a chart ID.
     * @param chartId the chart ID
     * @return the chart data in CSV format
     */
    String getChartData(Integer chartId);

    /**
     * Replaces a chart's data with a new set of data.
     * @param chartId the chart ID
     * @param data the chart data in CSV format
     */
    void replaceChartData(Integer chartId, String data);

    /**
     * Appends data to an existing chart.
     * @param chartId the chart ID
     * @param data the chart data to append in CSV format
     */
    void appendDataToChart(Integer chartId, String data);

    /**
     * Deletes a chart with the given chart ID.
     * @param chartId the chart ID
     */
    void deleteChart(Integer chartId);
}
